#ifndef SUFFIXVALIDATOR_H
#define SUFFIXVALIDATOR_H

#include "stringvalidator.h"
#include "pretreatmenthandler.h"

class SuffixValidator : public StringValidator
{
public:
    SuffixValidator();
    SuffixValidator(const QString& suffix, const QString& errorMsg = "Invalid suffix")
        : m_suffix(suffix), m_errorMsg(errorMsg) {}

    ValidationResult validate(const QString& input,
                              const std::vector<ValidationOption>& options = {}) const override {
        QString processed = PretreatmentHandler::preprocess(input, options);

        if (processed.endsWith(m_suffix, PretreatmentHandler::getCaseSensitivity(options))) {
            return ValidationResult(true);
        }
        return ValidationResult(false, m_errorMsg.arg(m_suffix));
    }

private:
    QString m_suffix;
    QString m_errorMsg;
};

#endif // SUFFIXVALIDATOR_H
